Xbasic

*REVERSE Function

Syntax

Output_String as C = *REVERSE(C string)

Arguments

string

A non-null character string.

Description

Reverse the order of characters in a string.

Discussion

*REVERSE() returns a new character string by reversing the sequence of characters in the Input_String.

Example

A simple example.

*REVERSE("Edward")   -> "drawdE"

This example substitutes an "and" for the last comma in a list.

strng="Mike" 
 ? if(at(",",strng)=0,strng,*reverse( strtran( *reverse(strng),",","dna ",1,1) ) ) 
 = "Mike" 

 strng = "John, Peter, David, Andrew" 
 ? if(at(",",strng)=0,strng,*reverse( strtran( *reverse(strng),",","dna ",1,1) ) ) 
 = "John, Peter, David and Andrew"

See Also